
//  UILabel+Extension.swift
//  WHSinaWeiBo
//
//  Created by 王寒 on 16/4/11.
//  Copyright © 2016年 wanghan. All rights reserved.
//

import UIKit


extension UILabel{
    

    convenience init(text: String,textColor: UIColor,fontSize: CGFloat,margin: CGFloat = 0){
        
        self.init()
        self.text = text
        self.textColor = textColor
        self.font = UIFont.systemFontOfSize(fontSize)
        self.numberOfLines = 0
        self.textAlignment  = NSTextAlignment.Center
        if margin > 0 {
            self.preferredMaxLayoutWidth = ScreenWidth - 2 * margin
            self.textAlignment = NSTextAlignment.Left
        }
        //自适应大小
        self.sizeToFit()
        
    }
    
    
}